<?php
$serv=new Swoole\Server("0.0.0.0",9505);
$serv->set([
    "heartbeat_idle_time"=>"120",
    "heartbeat_check_interval"=>"60",
    //'open_eof_check' => true,   //打开EOF检测
    //'package_eof'    => "\r\n", //设置EOF
    //'daemonize'=>"1",
]);

//监听连接进入时间
$serv->on("Connect",function($serv,$fd){
    
    echo "Client ".$fd.": Connect.\n";
});

//监听数据接收事件
$serv->on("Receive",function($serv,$fd,$from_id,$data){
    
    echo "接收到".$fd."的信息的".$data."\r\n\r\n";
    
    $result="Server: ";
    
    
   
});

//监听连接关闭事件
$serv->on("Close",function($serv,$fd){
    
    echo $res."\n";
    echo "Client: ".$fd."Close.\n";
});

echo "启动swoole tcp server 访问地址 0.0.0.0:9505 \n";

//启动服务器
$serv->start();